﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Infrastructure.UnitWork;
using SqlSugar;

namespace Infrastructure.Repositories
{
    public class Repository<TEntity> : SimpleClient<TEntity>, IRepository<TEntity> where TEntity : class, new()
    {
        private readonly SqlSugarScope _db;
        public SqlSugarScope Db => _db;

        public ISugarQueryable<TEntity> Queryable => Db.Queryable<TEntity>();

        public Repository(IUnitOfWork unitOfWork)
        {
            _db = unitOfWork.SqlSugarScope;
            base.Context = _db;
        }
    }
}
